package com.bye.xiaomi_mall.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bye.xiaomi_mall.mapper.TdAddressMapper;
import com.bye.xiaomi_mall.domain.TdAddress;
import com.bye.xiaomi_mall.service.ITdAddressService;

/**
 * 收货地址Service业务层处理
 *
 * @author ruoyi
 * @date 2025-03-15
 */
@Service
public class TdAddressServiceImpl implements ITdAddressService {
    @Autowired
    private TdAddressMapper tdAddressMapper;

    /**
     * 查询收货地址
     *
     * @param id 收货地址主键
     * @return 收货地址
     */
    @Override
    public TdAddress selectTdAddressById(Long id) {
        return tdAddressMapper.selectTdAddressById(id);
    }

    /**
     * 查询收货地址列表
     *
     * @param tdAddress 收货地址
     * @return 收货地址
     */
    @Override
    public List<TdAddress> selectTdAddressList(TdAddress tdAddress) {
        return tdAddressMapper.selectTdAddressList(tdAddress);
    }

    /**
     * 新增收货地址
     *
     * @param tdAddress 收货地址
     * @return 结果
     */
    @Override
    public int insertTdAddress(TdAddress tdAddress) {
        return tdAddressMapper.insertTdAddress(tdAddress);
    }

    /**
     * 修改收货地址
     *
     * @param tdAddress 收货地址
     * @return 结果
     */
    @Override
    public int updateTdAddress(TdAddress tdAddress) {


        tdAddressMapper.updateTdAddress2(tdAddress);

        return tdAddressMapper.updateTdAddress(tdAddress);
    }

    /**
     * 批量删除收货地址
     *
     * @param ids 需要删除的收货地址主键
     * @return 结果
     */
    @Override
    public int deleteTdAddressByIds(Long[] ids) {
        return tdAddressMapper.deleteTdAddressByIds(ids);
    }

    /**
     * 删除收货地址信息
     *
     * @param id 收货地址主键
     * @return 结果
     */
    @Override
    public int deleteTdAddressById(Long id) {
        return tdAddressMapper.deleteTdAddressById(id);
    }
}
